using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class card : MonoBehaviour
{
    BoxCollider2D coll;
    bool isdrag = false;
    // Start is called before the first frame update
    void Start()
    {
        coll = GetComponent<BoxCollider2D>();
    }


    // Update is called once per frame
    void Update()
    {

        if (Input.GetMouseButtonDown(0))
        {
            isdrag = true;
        }

        isdrag = true;
        Vector2 v = transform.position;
        Vector2 m = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2 der = m - v;
        if (isdrag)
        {
            Debug.Log("mouse in");

            if (Input.GetMouseButton(0))
            {
                transform.position = Vector2.Lerp(transform.position, m + der, 0.5f);
            }

            if (Input.GetMouseButtonUp(0))
            {
                isdrag= false;
                Debug.Log("mouse exit");
            }
        }
    }
}
